package com.huahua.myIdea.service.serviceImpl;

import com.huahua.myIdea.dao.INewGoodsDao;
import com.huahua.myIdea.entity.GoodsDo;
import com.huahua.myIdea.service.NewGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class NewGoodsServiceImpl implements NewGoodsService {
    @Autowired
    private INewGoodsDao newGoodsDao;

    @Override
    public GoodsDo findNewGoodsByName(String name) {
        return newGoodsDao.findByName(name);
    }

    public GoodsDo saveNewGoodsByName(GoodsDo newGood) {
        newGoodsDao.save(newGood);
        return newGoodsDao.findByName(newGood.getName());
    }
}
